package com.demo.component;

import com.demo.model.Student;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86187
 * Date: 2023-03-12
 * Time: 23:32
 */

@Component // 配合 @Bean 注解使用.
public class StudentBeans {

    // @Bean 注解必须要配合 5 大类注解使用!!
    @Bean
    public Student getStudentBeans() {
        Student student = new Student();
        student.setId(12);
        student.setName("啊伟");
        student.setAge(18);

        return student;
    }

    @Bean(name = {"student"})
    public Student getStudentBeans2() {
        Student student = new Student();
        student.setId(16);
        student.setName("啊强");
        student.setAge(20);

        return student;
    }
}
